package com.cotasul.tela.datamodel;

import java.util.List;

import javax.faces.model.ListDataModel;

import org.primefaces.model.SelectableDataModel;

import com.cotasul.bean.FormaPagamentoBean;

public class FormaPagamentoDataModel extends ListDataModel<FormaPagamentoBean> implements SelectableDataModel<FormaPagamentoBean>  {

	
	public FormaPagamentoDataModel(List<FormaPagamentoBean> data) {
		super(data);
	}
	
	
	@SuppressWarnings("unchecked")
	@Override
	public FormaPagamentoBean getRowData(String linha) {
		List<FormaPagamentoBean> formas = (List<FormaPagamentoBean>) getWrappedData();
		for(FormaPagamentoBean forma : formas){
			if((""+forma.getIdFormaPag()).equals(linha)){
				return forma;
			}
		}
		return null;
	}

	@Override
	public Object getRowKey(FormaPagamentoBean linha) {
		// TODO Auto-generated method stub
		return linha.getIdFormaPag();
	}
	

}
